#include "CF.h"
#include "CF_MainWindow.h"
#include "CF_WorkspaceManager.h"

CF_MainWindow::CF_MainWindow(QWidget *parent)
	: CL_MainWindow(parent)
{
	ui.setupUi(this);
	m_tabBar = new QTabBar(this);
	m_tabBar->setExpanding(false);
	m_tabBar->addTab(tr("Scene"));
	ui.gridLayout_2->addWidget(m_tabBar, 0, 0, 1, 1);
	
	CL_MainWindow::initialize();

	QPixmap newWorkspaceIcon(tr(":/Icon/NewWorkspace"));
	QPixmap openWorkspaceIcon(tr(":/Icon/OpenWorkspace"));
	ui.mainToolBar->setIconSize(newWorkspaceIcon.size());

	QAction* newWorkspaceAction = ui.mainToolBar->addAction(QIcon(newWorkspaceIcon), tr("New Workspace"));
	QAction* openWorkspaceAction = ui.mainToolBar->addAction(QIcon(openWorkspaceIcon), tr("Open Workspace"));

	QObject::connect(newWorkspaceAction, SIGNAL(triggered()), ui.workspaceWidget, SLOT(newWorkspace()));
	QObject::connect(openWorkspaceAction, SIGNAL(triggered()), ui.workspaceWidget, SLOT(openWorkspace()));
}

CF_MainWindow::~CF_MainWindow()
{
	delete m_tabBar;
}

void CF_MainWindow::addCocosWidget(QWidget* pWidget)
{
    ui.cocosFrame->addWidget(pWidget, 0, 0, 1, 1);
}
